
function ArrayList(){
	this.id = ArrayList.defaultInstanceName ;
	this.head = null ;
	this.elements = new Array();
	return this ;
}

ArrayList.defaultInstanceName = "ll";

ArrayList.prototype.set = function(index,obj){
	var len = this.elements.length ;
	if(len > index){
		this.elements[index] = obj ;
		return ;
	}
	if(index >= len){
		alert("LIST INDEX OUT OF BOUNCE");
		return ;
	}
	/*
	for(var i=len; i > index; i--){
		this.elements[i] = this.elements[i-1];
		this.elements[index] = obj ;
		return ;
	}
	*/
}
ArrayList.prototype.add = function(obj){
	this.elements[this.elements.length] = obj ;
}

ArrayList.prototype.get = function(index){
	var len = this.elements.length ;
	if(index >= len){
		alert("LIST INDEX OUT OF BOUNCE");
		return ;
	}
	return this.elements[index] ;
}

ArrayList.prototype.size = function(){
	return this.elements.length ;
}

ArrayList.prototype.remove = function(index){
	var len = this.elements.length ;
	if(index == (len-1)){
		this.elements.pop();
		return ;
	}
	if(index >= len){
		alert("LIST INDEX OUT OF BOUNCE");
		return ;
	}
	for(var i=index;i<(len-1);i++){
		this.elements[i] = this.elements[i+1];
	}
	this.elements.pop() ;
}
ArrayList.prototype.clear = function(){
	this.elements.length = 0 ;
}